package com.zch.set_;

import java.util.LinkedHashSet;
import java.util.Set;

@SuppressWarnings({"all"})
public class LinkedHashSetSource {
    public static void main(String[] args) {
        Set set = new LinkedHashSet();
        set.add(new String("a"));
        set.add(456);
        set.add(456);
        set.add(new Customer("刘", 1001));
        set.add(123);
        set.add("zch");

        System.out.println(set);
        //加入顺序和取出顺序一致
        //添加第一次时直接将数组table扩容到16，存放的结点类型是LinkedHashMap$Entry
        //数组是HashMap$Node[]，存放的元素是LinkedHashMap$Entry类型
    }
}

@SuppressWarnings({"all"})
class Customer {
    private String name;
    private int no;

    public Customer(String name, int no) {
        this.name = name;
        this.no = no;
    }
}
